package com.funnyx.importselector;

import com.funnyx.config.ElasticsearchAutoConfiguration;
import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;

public class EnableESConfigurationImportSelector implements ImportSelector {

  @Override
  public String[] selectImports(AnnotationMetadata importingClassMetadata) {

    // 这里暂时只需要使用ElasticsearchAutoConfiguration配置
    // 单配置文件也可以使用 return new String[] {ElasticsearchAutoConfiguration.class.getName()};
    //    AnnotationAttributes attributes =
    //        AnnotationAttributes.fromMap(
    //            importingClassMetadata.getAnnotationAttributes(
    //                EnableESConfigurationImportSelector.class.getName()));
    //    Class clazz = attributes.getClass("value");
    //    return new String[] {clazz.getName()};
    return new String[] {ElasticsearchAutoConfiguration.class.getName()};
  }
}
